<%--
  Created by IntelliJ IDEA.
  User: Liston
  Date: 2018/12/8
  Time: 21:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <%
        pageContext.setAttribute("APP_PATH", request.getContextPath()); //teacher_science_system/
%>
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="../static/bootstrap337/css/bootstrap.css">
    <title>教师</title>
</head>
<jsp:include page="teacher_header.jsp"/>

<div class="container">
    <form class="form-horizontal" id="add" method="post">
        <table class="table table-bordered">
            <div class="form-group">
                <caption>会议添加</caption>
                <tr>
                    <th><div class="col-sm-6"> <span class="star">*</span> 会议名称：<span class="canNotBeEmpty"></span></div></th>
                    <th>
                        <input class="form-control" name="meetingname">
                    </th>
                </tr>

                <tr>
                    <th><div class="col-sm-6">会议地点：</div></th>
                    <th>
                        <input class="form-control" name="meetingposition">
                    </th>
                </tr>

                <tr>
                    <th><div class="col-sm-6">会议主持人：</div></th>
                    <th>
                        <input class="form-control" name="meetinghost">
                    </th>
                </tr>

                <tr>
                    <th><div class="col-sm-6">会议内容：</div></th>
                    <th>
                        <input class="form-control" name="meetingcontent">
                    </th>
                </tr>

                <tr>
                    <th><div class="col-sm-6">会议开始时间：</div></th>
                    <th>
                        <input class="form-control" name="begintime">
                    </th>
                </tr>

                <tr>
                    <th><div class="col-sm-6">会议结束时间：</div></th>
                    <th>
                        <input class="form-control" name="endtime">
                    </th>
                </tr>

            </div>
        </table>
        <div class="col-md-4 col-md-offset-4">
            <button class="btn btn-primary btn-lg" type="reset">重置</button>
            <button class="btn btn-success btn-lg" id="btn_add_meeting">提交</button>
        </div>
    </form>

    <script>

        var flag = true;
        $("#btn_add_meeting").click(function () {
            var meetingName = $("input[name='meetingname']").val()
            if(meetingName==''){
                flag = false;
            }
            if(flag == false){
                alert('抱歉该项不能为空！')
                return;
            }else{
                $.ajax({
                    url:"${APP_PATH}/add_meeting",
                    type:"POST",
                    data:$("#add").serialize(),
                    success:function (result) {
                        alert(result.message)
                    },
                    error:function () {
                        alert("请求失败！");
                    }
                });
            }
        });

    </script>
</div>

</body>
</html>
